package com.tianshi.yingxue_project.Test;

import com.tianshi.yingxue_project.entity.Admin;
import com.tianshi.yingxue_project.service.AdminService;
import com.tianshi.yingxue_project.utils.Md5Utils;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

//import org.springframework.boot.test.context.SpringBootTest;

//@SpringBootTest
public class AdminServiceTest {
    @Test
    public void testMD5(){
        String password = "123456";
        System.out.printf("加密前："+password);

        String md5Code= Md5Utils.getMd5Code(password);
        System.out.printf("加密后："+md5Code);

        String salt=Md5Utils.getSalt(6);
        System.out.printf("随机盐："+salt);

        password=salt+password+salt;

        String md5Code2= Md5Utils.getMd5Code(password);
        System.out.printf("加密后："+md5Code2);

    }
    @Autowired
    private AdminService adminService;
    @Test
    public void testRegister() {
        String username = "admin";
        String password = "123456";
        String status = "1";
        Admin admin = new Admin(null, username, password, status, "");
        adminService.register(admin);
    }

}
